package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Fojkncsm type
*/
@SuppressWarnings("ALL")
public class Fojkncsm {


        private static volatile Fojkncsm instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Fojkncsm getInstance() {
            if (instance == null) {
                synchronized (Fojkncsm.class) {
                    if (instance == null) {
                        instance = new Fojkncsm();
                    }
                }
            }
            return instance;
        }


        private Fojkncsm() {

        }



    public  Boolean judgeJufxsnodje(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOlqsqnbcmd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZafulboohr(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWnmusbjbjs(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDwjsretzpw(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgePrwtdfhvpa(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDtudkaqyqy(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeMmfhjbievm(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTkheifvstt(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  jufxsnodje;
    private String  olqsqnbcmd;
    private String  zafulboohr;
    private String  wnmusbjbjs;
    private String  dwjsretzpw;
    private String  prwtdfhvpa;
    private String  dtudkaqyqy;
    private String  mmfhjbievm;
    private String  tkheifvstt;


    public void setJufxsnodje(String jufxsnodje){
    this.jufxsnodje = jufxsnodje;
    }

    public String getJufxsnodje(){
    return this.jufxsnodje;
    }
    public void setOlqsqnbcmd(String olqsqnbcmd){
    this.olqsqnbcmd = olqsqnbcmd;
    }

    public String getOlqsqnbcmd(){
    return this.olqsqnbcmd;
    }
    public void setZafulboohr(String zafulboohr){
    this.zafulboohr = zafulboohr;
    }

    public String getZafulboohr(){
    return this.zafulboohr;
    }
    public void setWnmusbjbjs(String wnmusbjbjs){
    this.wnmusbjbjs = wnmusbjbjs;
    }

    public String getWnmusbjbjs(){
    return this.wnmusbjbjs;
    }
    public void setDwjsretzpw(String dwjsretzpw){
    this.dwjsretzpw = dwjsretzpw;
    }

    public String getDwjsretzpw(){
    return this.dwjsretzpw;
    }
    public void setPrwtdfhvpa(String prwtdfhvpa){
    this.prwtdfhvpa = prwtdfhvpa;
    }

    public String getPrwtdfhvpa(){
    return this.prwtdfhvpa;
    }
    public void setDtudkaqyqy(String dtudkaqyqy){
    this.dtudkaqyqy = dtudkaqyqy;
    }

    public String getDtudkaqyqy(){
    return this.dtudkaqyqy;
    }
    public void setMmfhjbievm(String mmfhjbievm){
    this.mmfhjbievm = mmfhjbievm;
    }

    public String getMmfhjbievm(){
    return this.mmfhjbievm;
    }
    public void setTkheifvstt(String tkheifvstt){
    this.tkheifvstt = tkheifvstt;
    }

    public String getTkheifvstt(){
    return this.tkheifvstt;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}